
import './App.css';

import { Routes, Route ,Navigate } from 'react-router-dom';
import About from '@/about/about'
import routes from './router'
import { Suspense } from 'react'
import { Loading } from 'react-vant';


function App(){
  return (
         <Suspense fallback={<div style={styles.wrapper}>{<Loading type="ball" />}loading</div>}>
          <Routes>
            {/* 动态注册所有路由 */}
            {routes.map((route) => (
              <Route
                key={route.path}
                path={route.path}
                element={
                  <route.component />
                }
              />
            ))}
            
            {/* 处理根路径重定向 */}
            {/* <Route 
              path="/" 
              element={<Navigate to="/approveSparePartsRequisition" replace />} 
            /> */}
          </Routes>
      </Suspense>
  )
}

export default App;

const styles = {
  wrapper: {
    color: "rgb(179 172 172)",
    marginTop: 10,
    textAlign: 'center',
    fontSize: 12
  }
}

